<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head></head>
<body style="width: 2000px;">
<script type="text/javascript">
 $(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules: {
			gbprice: {isMoney: true},
			zspointnum:{isMoney: true},
			zsdedunum:{isMoney: true},
			zscouponnum:{isMoney: true},
			/* marketPrice: {isMoney: true}, */
			sellPrice: {isMoney: true},
			sellerprice: {isMoney: true},
			
			oppoint: {isMoney: true},
			opdedu: {isMoney: true},
			opcoupon: {isMoney: true},
			
			muchsellerprice: {isMoney: true},
			mppoint: {isMoney: true},
			mpdedu: {isMoney: true},
			mpcoupon: {isMoney: true},
			
			price:{isMoney: true},
			stock:{digits: true},		
			zdsx:{digits: true},
			yyts:{digits: true},
			jyrs:{digits: true},
			zdrs:{digits: true},
		},
		messages:{
			gbprice: {required: "请输入团购销售价",isMoney: "请填写正确的金额，最多保留两位小数位"},
			zspointnum: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			zsdedunum: {required: "请输入抵扣券",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			zscouponnum: {required: "请输入优惠券",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			/* marketPrice: {required: "请输入商品分公司价",isMoney: "请填写正确的金额，最多保留两位小数位"}, */
			sellPrice: {required: "请输入市场价格",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			sellerprice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			
			oppoint: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			opdedu: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			opcoupon: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			muchsellerprice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			mppoint: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			mpdedu: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			mpcoupon: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},	
			price: {required: "请输入价值",isMoney: "请填写正确的价值，最多保留两位小数位"},
			
			stock: {required: "请输入商品库存",digits: "请填写正确的数量"},
			zdsx: {required: "请输入正确的指定上限",digits: "请填写正确的数量"},
			yyts: {required: "请输入商品库存",digits: "请填写正确的数量"},
			jyrs: {required: "请输入正确的建议",digits: "请填写正确的数量"},
			zdrs: {required: "请输入正确的指定人数",digits: "请填写正确的数量"},
			categoryonid: {required: "请选择一级分类"},
			categorytwid: {required: "请选择二级分类"},
			categorythid: {required: "请选择三级分类"},
			categoryfoid: {required: "请选择四级分类"}
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					case 2:
						Kit.alert("请选择商品分类");return;
					case 3:
						Kit.alert("请选择要增加分公司");return;
					/* case 4:
						Kit.alert("请添加门市价");return;  */
					case 5:
						Kit.alert("请添加库存");return;
					case 6:
						Kit.alert("请添加客服二维码");return;
					case 7:
						Kit.alert("Logo图片不能为空！");return;
					case 8:
						Kit.alert("请添加价格");return;
					case 9:
						Kit.alert("请添加客服二维码");return;
					case 10:
						Kit.alert("请填写宝贝内容");return;
					case 11:
						Kit.alert("请填写规格内容");return;
					case 12:
						Kit.alert("请点击添加轮播图片，进行图片的添加！");return;
					case 13:
						Kit.alert("请点击添加详情图片，进行图片的添加！");return;
					case 14:
						Kit.alert("添加分公司错误");return;
					case 16:
						Kit.alert("已选中赠送优惠，请选择赠送的积分值选项");return;
					case 17:
						Kit.alert("已选中赠送优惠积分类别，请填写积分值");return;
					case 18:
						Kit.alert("已选中赠送优惠折扣类别，请填写折扣");return;
					case 19:
						Kit.alert("已选中赠送优惠优惠券类别，请填写优惠券");return;
					case -1:
						Kit.alert("网络繁忙...，请重试");
						editDialog.close();
						return; 
					case 0:
						onEditSuccess(data.object);
						editDialog.close();
						return;
					}
				}
			});
		}
	});
}); 

 $(document).ready(function(){
    $("#addTable").click(function(){
       var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" name=\"check\" checked=\"checked\" />"+
       "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" name=\"name\" maxlength=\"10\" style=\"width:195px;height:30px;\"/>"+
       "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" name=\"number\"  onkeyup=\"(this.vads=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)\" onblur=\"this.vads();\" style=\"width:195px;height:30px;\" />"+
       "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" name=\"price\" onkeyup=\"(this.vads=function(){this.value=this.value.replace(/[^0-9]+/-.,'');}).call(this)\" onblur=\"this.vads();\" style=\"width:195px;height:30px;\" />"+
       "</td></tr>";
              $("#tableb").append(tr);
    });
    $("#deleteTable").click(function(){
        var check = document.getElementsByName("check");
        for(var i=0;i<check.length;i++){
            if(check[i].checked){
                 document.getElementById('tableb').deleteRow(i);
                 i--;
            }
        }
    });
     $("#deleteTablea").click(function(){
        var check = document.getElementsByName("checks");
        var ths=check.length;
        var numb=parseFloat($("#chooseNum").html());
        for(var i=0;i<check.length;i++){
            if(check[i].checked){          
                 document.getElementById('tablea').deleteRow(i);
                 i--;           
                 numb--;            
                if(numb<0){
                	numb=0;
                } 
            }       
        }
        $("#chooseNum").text((numb));
        $("#storeid").val((numb));
    })
}) 
  var addStoreDialog;
 function addStore(){
	addStoreDialog = Kit.dialog("添加分公司","${BASE_PATH}/bus/goods/base/chooseStore",{closable:true,size:'size-wide'}).open();
}  

function onStoreChoosed(storeid,title,address,tel){
	var trs= $("#tablea tr");
	var array=new Array();
	var numb=parseFloat($("#chooseNum").html());
	for (var i = 0; i < trs.length; i++) {
		var tds = $(trs[i]).children();
		var sid = $(tds[0]).find("#ids").val();
		array.push(sid);
	}
	if(contains(array,storeid)){
		alert("该分公司已添加");    
	}else{
	 var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" id=\"ids\" checked=\"checked\" name=\"checks\" value='"+storeid+"'/>"+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+title+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+address+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+tel+
     "</td></tr>";
     $("#tablea").append(tr);
     $("#chooseNum").text((numb+1));
     $("#storeid").val((numb+1));
	}
}
function contains(arr, obj) {  
    var i = arr.length;  
    while (i--) {  
        if (arr[i] === obj) {  
            return true;  
        }  
    }  
    return false;  
} 
/* var type=${goods.type };
if(type==1){
	$("#jifen").hide();
}else if(type==2){
	$("#huibi").hide();
}else if(type==3){
	
} */
var goodtype=${goods.goodtype};
var times="${goods.times }";
if(goodtype==1){
	$("#tbts").hide();
}else{
	if(times==1){
		$("#tbtd").hide();
	}else{
		
	}
}
var timetype=${goods.timetype};
if(timetype==1){
	$("#bufen").hide();
}
var buytype=${goods.buytype};
if(buytype==1){
	$("#zdsx").hide();
}
var yutype=${goods.yutype};
if(yutype==1){
	$("#yyts").hide();
}
var couper=${goods.couper};
if(couper==1||couper==0){
	$("#jyrs").hide();
	$("#xzrs").hide();
}else if(couper==2){
	$("#xzrs").hide();
	$("#xzrs").val("");
}else{
	$("#jyrs").hide();
	$("#jyrs").val("");
}

$("#gbattr").hide();
$("#zsnumattr").hide();
$("#gbfpperson").hide();
$("#zspointnum").hide();
$("#zsdedunum").hide();
$("#zscouponnum").hide();
$("#payonlyactivity").hide();
$("#oppoint").hide();
$("#opdedu").hide();
$("#opcoupon").hide();
$("#paymoneyandactivity").hide();
$("#muchsellerprice").hide();
$("#mppoint").hide();
$("#mpdedu").hide();
$("#mpcoupon").hide();
$(".mpay").click(function(){
	var v = $('input[name="multipay"]').filter(':checked').val(); 
	if(v==1){
		$("#sellerprice").show();
		$("#payonlyactivity").hide();
		$("#oppoint").val("");
		$("#opdedu").val("");
		$("#opcoupon").val("");
		$("#paymoneyandactivity").hide();
		$("#muchsellerprice").val("");
		$("#mppoint").val("");
		$("#mpdedu").val("");
		$("#mpcoupon").val("");
	}else 
	if(v==2){
		$("#sellerprice").hide();
		$("#sellerprice").val("");
		$("#paymoneyandactivity").hide();
		$("#mppoint").val("");
		$("#mpdedu").val("");
		$("#mpcoupon").val("");
		$("#payonlyactivity").show();
		$("#payonlyactivity").click(function(){
			 var vs = $('input[name="onlypaypoint"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#oppoint").show();
			 }else{
				 $("#oppoint").hide();
				 $("#oppoint").val("");
			 }
			 var vs = $('input[name="onlypaydedu"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opdedu").show();
			 }else{
				 $("#opdedu").hide();
				 $("#opdedu").val("");
			 }
			 var vs = $('input[name="onlypaycoupon"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opcoupon").show();
			 }else{
				 $("#opcoupon").hide();
				 $("#opcoupon").val("");
			 }		 
		});
	}else if(v==3){
		$("#sellerprice").hide();
		$("#sellerprice").val("");
		$("#payonlyactivity").hide();
		$("#oppoint").val("");
		$("#opdedu").val("");
		$("#opcoupon").val("");
		$("#paymoneyandactivity").show();
		$("#paymoneyandactivity").click(function(){
			var vsp= $('input[name="mpayprice"]').filter(':checked').val(); 
			if(vsp==1){
				$("#muchsellerprice").show();
			}else{
				$("#muchsellerprice").hide();
				$("#muchsellerprice").val("");
			}
			var vsp= $('input[name="mpaypoint"]').filter(':checked').val(); 
			if(vsp==1){
				$("#mppoint").show();
			}else{
				$("#mppoint").hide();
				$("#mppoint").val("");
			}
			var vsd = $('input[name="mpaydedu"]').filter(':checked').val(); 
			if(vsd==1){
				$("#mpdedu").show();
			}else{
				$("#mpdedu").hide();
				$("#mpdedu").val("");
			}
			var vsc = $('input[name="mpaycoupon"]').filter(':checked').val(); 
			if(vsc ==1){
				$("#mpcoupon").show();
			}else{
				$("#mpcoupon").hide();
				$("#mpcoupon").val("");
			}		 
		});
	}
});
/* 是否团购 */
$(".group").click(function(){
	var v = $('input[name="groupbuying"]').filter(':checked').val(); 
	if(v==1){
		$("#gbattr").hide();
	}else if(v==2){
		$("#gbattr").show();
		/* 团购方法 */	 
		$(".gmethod").click(function(){
			var vs = $('input[name="gbmethod"]').filter(':checked').val(); 
			if(vs==1){
				$("#gbfpperson").hide();
			}else if(vs==2){
				$("#gbfpperson").show();
			}else if(vs==3){
				$("#gbfpperson").show();
			}
		});
	}
}); 
/* 是否赠送优惠 */	 
$(".zactivity").click(function(){
	var v = $('input[name="zsactivity"]').filter(':checked').val(); 
	if(v==1){
		$("#zsnumattr").hide();
	}else if(v==2){
		$("#zsnumattr").show();
		$("#zsnumattr").click(function(){
			 var vsp = $('input[name="zspoint"]').filter(':checked').val(); 
			 if(vsp==1){
				 $("#zspointnum").show();
			 }else{
				 $("#zspointnum").hide();
				 $("#zspointnum").val("");
			 }
			 var vsd = $('input[name="zsdedu"]').filter(':checked').val(); 
			 if(vsd==1){
				 $("#zsdedunum").show();
			 }else{
				 $("#zsdedunum").hide();
				 $("#zsdedunum").val("");
			 }
			 var vsc = $('input[name="zscoupon"]').filter(':checked').val(); 
			 if(vsc==1){
				 $("#zscouponnum").show();
			 }else{
				 $("#zscouponnum").hide();
				 $("#zscouponnum").val("");
			 }		 
		});
	}	
});
 $(".tuan").click(function(){
		var v = $('input[name="goods"]').filter(':checked').val(); 
		if(v==1){
			$("#tbts").hide();
		}else if(v==2){
			$("#tbts").show();
			 $("#tbts").click(function(){
				 var vs = $('input[name="times"]').filter(':checked').val(); 
				 if(vs==1){
					 $("#tbtd").hide();
				 }else{
					 $("#tbtd").show();
				 }
			 });
		}
	});
 $(".kysj").click(function(){
		var v = $('input[name="keyong"]').filter(':checked').val(); 
		if(v==1){
			$("#bufen").hide();
		}else if(v==2){
			$("#bufen").show();
		}
	});
 $(".gmsx").click(function(){
		var v = $('input[name="goumai"]').filter(':checked').val(); 
		if(v==1){
			$("#zdsx").hide();
		}else if(v==2){
			$("#zdsx").show();
		}
	});
 $(".xyyy").click(function(){
		var v = $('input[name="yuyue"]').filter(':checked').val(); 
		if(v==1){
			$("#yyts").hide();
		}else if(v==2){
			$("#yyts").show();
		}
	});
 $(".syrs").click(function(){
		var v = $('input[name="shiyongrenshu"]').filter(':checked').val(); 
		if(v==0){
			$("#jyrs").hide();
			$("#xzrs").hide();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}else if(v==1){
			$("#jyrs").hide();
			$("#xzrs").hide();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}else if(v==2){
			$("#jyrs").show();
			$("#xzrs").hide();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}else{
			$("#jyrs").hide();
			$("#xzrs").show();
			$("#jyrss").val("");
			$("#xzrss").val("");
		}
	});



//DATE PICKER处理时间
 $('.datetimepicker').datetimepicker({
		  format:"yyyy-mm-dd",
		   startView:2,
			minView:2,
            language:  'zh',
            weekStart: 1,
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 1,
          showMeridian: 1,
           pickerPosition:'top-right'
      }).on('hide', function(event) {
           event.preventDefault();
         event.stopPropagation();
   });


 //团购时间逻辑
 $("#gbbegintime").datetimepicker({
	 	format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'0',
	    language: 'zh-CN',
	    pickerPosition:'bottom-right',
	    autoclose:true,
	    todayBtn:true,
	    todayHighlight:true,
	}).on("click",function(){
		
	    $("#gbbegintime").datetimepicker("setEndDate",$("#gbendtime").val());

	});


	$("#gbendtime").datetimepicker({
		format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'0',
	    language: 'zh-CN',
	    pickerPosition:'bottom-right',
	    autoclose:true,
	    todayBtn:true,
	    todayHighlight:true,
		}).on("click",function(){
			var d=$("#gbbegintime").val();
			var d1=new Date(d); 
			d1.setFullYear(d1.getFullYear()+1); 
			d1.setDate(d1.getDate()-1); 
			$("#gbendtime").datetimepicker("setEndDate",d1);
			$("#gbendtime").datetimepicker("setStartDate",$("#gbbegintime").val());
		});

 //限定时间
  $("#sBeginDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    pickerPosition:'bottom-right',
	    autoclose:true,
	}).on("click",function(){
	    $("#sBeginDate").datetimepicker("setEndDate",$("#sEndDate").val());
	});

	$("#sEndDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii:ss',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    autoclose:true,
		}).on("click",function(){
			var d=$("#sBeginDate").val();
			var d1=new Date(d); 
			d1.setFullYear(d1.getFullYear()+1); 
			d1.setDate(d1.getDate()-1); 
			 $("#sEndDate").datetimepicker("setEndDate",d1);
			$("#sEndDate").datetimepicker("setStartDate",$("#sBeginDate").val());
		});
		
	 $(document).on("click","#sEndDate",function(){
	    	$('#sEndDate').datetimepicker('show');
	    });
   
   $(document).on("click","#sBeginDate",function(){
   	$('#sBeginDate').datetimepicker('show');
   }); 
   
   $("#beginDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    pickerPosition:'bottom-right',
	    autoclose:true,
	}).on("click",function(){
	    $("#beginDate").datetimepicker("setEndDate",$("#endDate").val());
	});

	$("#endDate").datetimepicker({
	    format: 'yyyy-mm-dd hh:ii',
	    minuteStep:1,
	    minView:'hour',
	    language: 'zh-CN',
	    autoclose:true,
		}).on("click",function(){
			var d=$("#beginDate").val();
			var d1=new Date(d); 
			d1.setFullYear(d1.getFullYear()+1); 
			d1.setDate(d1.getDate()-1); 
			$("#endDate").datetimepicker("setEndDate",d1);
			$("#endDate").datetimepicker("setStartDate",$("#beginDate").val());
		});
		
	 $(document).on("click","#endDate",function(){
	    	$('#endDate').datetimepicker('show');
	    });
  
  $(document).on("click","#beginDate",function(){
  	$('#beginDate').datetimepicker('show');
  });
  
 var imagesDialog;
 function toUploadImages(){
 	imagesDialog = Kit.dialog("轮播图片","${BASE_PATH}/bus/goods/base/imageIndex/${goods.LunBoNum}",{closable:true,size:"size-wide"}).open();
 }
 
 /* 添加规格 */
 /* function addSpec(){
		var trs= $("#tablespec tr");
		var array=new Array();
		var numb=parseFloat($("#chooseSpecNum").html());
		for (var i = 0; i < trs.length; i++) {
			var tds = $(trs[i]).children();
			var sid = $(tds[1]).find("#KspecName").val();
			array.push(sid);
		}
		var id = array.length +1;
		var specName = $("#specName").val(); //商品规格名称
		var specNum = $("#specNum").val();  //此规格商品的数量
		var marketPrice = $("#marketPrice").val();  //分公司分公司价
		var stock = $("#stock").val(); //库存数量

		var multipay = $('input[name="multipay"]').filter(':checked').val();//多支付类型1.单货币2.单优惠3.组合
		var sellerprice = $("#sellerprice").val(); //单独货币支付价格
		var onlypaypoint = $('input[name="onlypaypoint"]').filter(':checked').val(); //单独优惠支付积分值类型值
		var oppoint = $("#oppoint").val(); //单独优惠支付积分值值
		var onlypaydedu = $('input[name="onlypaydedu"]').filter(':checked').val(); //单独优惠支付抵扣券类型值
		var opdedu = $("#opdedu").val(); //单独优惠支付抵扣券值		
		var onlypaycoupon = $('input[name="onlypaycoupon"]').filter(':checked').val(); //单独优惠支付优惠券类型值
		var opcoupon = $("#opcoupon").val(); //单独优惠支付积教育分值
		var mpayprice = $('input[name="mpayprice"]').filter(':checked').val();//组合货币支付类型值
		var muchsellerprice = $("#muchsellerprice").val(); //组合支付货币支付价格
		var mpaypoint = $('input[name="mpaypoint"]').filter(':checked').val(); //组合支付积分值类型值
		var mppoint = $("#mppoint").val(); //组合支付积分值值
		var mpaydedu = $('input[name="mpaydedu"]').filter(':checked').val(); //组合支付抵扣券类型值
		var mpdedu = $("#mpdedu").val(); //组合支付抵扣券值		
		var mpaycoupon = $('input[name="mpaycoupon"]').filter(':checked').val(); //组合支付优惠券类型值
		var mpcoupon = $("#mpcoupon").val(); //组合支付优惠券值
		
		
		var optotal = "无";//全部的单优惠方式
		var opoint = "";
		var odedu = "";
		var ocoupon = "";
		var mptotal = "无";//全部的组合方式
		var mprice = "";
		var mpoint = "";
		var mdedu = "";
		var mcoupon = "";
		//判断不为空
		if (specName==""){
			Kit.alert("商品规格不能为空！");
			return;
		}else if(specNum==""){
			Kit.alert("规格商品的数量不能为空！");
			return;
		}else if(marketPrice==""){
			Kit.alert("分公司分公司价不能为空！");
			return;
		}else if(stock==""){
			Kit.alert("库存数量不能为空！");
			return;
		} */
		//多种支付方式
		/* if(!multipay){
			Kit.alert("至少选择一种支付方式");
			return;
		} else {
			//判断是否是单货币支付方式
			if(multipay == 1){
				if(!sellerprice || sellerprice==0){
					Kit.alert("单货币支付方式——价格不能为空或者0！");
					return;
				}else{
					//单货币赋值
					sellerprice = sellerprice;
				}
			}else{
				sellerprice = "无";
			}
			//判断是否是单优惠支付方式
			if(multipay == 2){
				if(!onlypaypoint && !onlypaydedu && !onlypaycoupon){
					Kit.alert("您已选择优惠支付，请选择优惠方式！");
					return;
				}else{
					//判断是否是单优惠支付积分方式
					if(onlypaypoint == 1){
						if(!oppoint || oppoint==0){
							Kit.alert("优惠支付方式——积分不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							opoint = "积分:" + oppoint + ";";
						}
					}
					//判断是否是单优惠支付折扣方式
					if(onlypaydedu == 1){
						if(!opdedu || opdedu==0){
							Kit.alert("优惠支付方式——折扣不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							odedu = "折扣:" + opdedu + ";";
						}
					}
					//判断是否是单优惠支付优惠券方式
					if(onlypaycoupon == 1){
						if(!opcoupon || opcoupon==0){
							Kit.alert("优惠支付方式——优惠券不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							ocoupon = "优惠券:" + opcoupon;
						}
					}
				optotal = opoint + odedu  + ocoupon;//拼接字符串
				}
			}
			//判断是否为组合支付方式
			if(multipay == 3){
				if(!mpayprice && !mpaypoint && !mpaydedu && !mpaycoupon){
					Kit.alert("您已选择组合支付，请选择组合付款方式！");
					return; 
				}else if(!mpaypoint && !mpaydedu && !mpaycoupon){
					Kit.alert("您已选择组合支付，请选至少选择一种优惠方式！");
					return; 
				}else{
					//判断组合支付方式货币是否为空
					if(mpayprice == 1){
						if(!muchsellerprice || muchsellerprice == 0){
							Kit.alert("组合支付方式——货币不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							mprice = "货币:" + muchsellerprice + "/";
						}
					}else{
						Kit.alert("组合支付方式——必须包含货币支付");
						return;
					}
					//判断是否是组合支付积分方式
					if(mpaypoint == 1){
						if(!mppoint || mppoint == 0){
							Kit.alert("组合支付方式——积分不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							mpoint = "积分:" + mppoint + ";";
						}
					}
					//判断是否是组合支付折扣方式
					if(mpaydedu == 1){
						if(!mpdedu || mpdedu == 0){
							Kit.alert("组合支付方式——折扣不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							mdedu = "折扣:" + mpdedu + ";";
						}
					}
					//判断是否是组合支付优惠券方式
					if(mpaycoupon == 1){
						if(!mpcoupon || mpcoupon==0){
							Kit.alert("组合支付方式——优惠券不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							mcoupon = "优惠券:" + mpcoupon;
						}
					}	
				mptotal = mprice + mpoint + mdedu + mcoupon;//拼接字符串
				}
			} 
		}*/
		/* if(contains(array,specName)){
			alert("该规格已经添加！");
		}else{
			var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" id=\"ids\" checked=\"checked\" name=\"specChecks\" value='"+id+"'/>"+
			"</td><td  style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KspecName\" hidden=\"hidden\" name=\"KspecName\"  value='"+specName+"'/>"+specName+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KspecNum\" hidden=\"hidden\" name=\"KspecNum\" value='"+specNum+"'/>"+specNum+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KmarketPrice\" hidden=\"hidden\" name=\"KmarketPrice\" value='"+marketPrice+"'/>"+marketPrice+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kstock\" hidden=\"hidden\" name=\"Kstock\" value='"+stock+"'/>"+stock+
			
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kmultipay\" hidden=\"hidden\" name=\"Kmultipay\" value='"+multipay+
				"'/><input type=\"text\" id=\"Ksellerprice\" hidden=\"hidden\" name=\"Ksellerprice\" value='"+sellerprice+"'/>"+sellerprice+ */
			
			/* "</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Koppoint\" hidden=\"hidden\" name=\"Koppoint\" value='"+oppoint+
				"'/><input type=\"text\" id=\"Kopdedu\" hidden=\"hidden\" name=\"Kopdedu\" value='"+opdedu+
				"'/><input type=\"text\" id=\"Kopcoupon\" hidden=\"hidden\" name=\"Kopcoupon\" value='"+opcoupon+"'/>"+optotal+

			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kmuchsellerprice\" hidden=\"hidden\" name=\"Kmuchsellerprice\" value='"+muchsellerprice+
				"'/><input type=\"text\" id=\"Kmppoint\" hidden=\"hidden\" name=\"Kmppoint\" value='"+mppoint+
				"'/><input type=\"text\" id=\"Kmpdedu\" hidden=\"hidden\" name=\"Kmpdedu\" value='"+mpdedu+
				"'/><input type=\"text\" id=\"Kmpcoupon\" hidden=\"hidden\" name=\"Kmpcoupon\" value='"+mpcoupon+"'/>"+mptotal+ */
			/* "</td></tr>";
			$("#tablespec").append(tr);
			$("#chooseSpecNum").text((numb+1));
			$("#specid").val((numb+1));
			    
		 	$("#specName").val(""); //商品规格名称
			$("#specNum").val("");  //此规格商品的数量
			$("#marketPrice").val("");  //分公司分公司价
			$("#stock").val(""); //库存数量
			$("input[name='multipay']").prop("checked",false);//多支付方式
			
			$("#sellerprice").val(""); //单独货币支付价格
			$("input[name='onlypaypoint']").prop("checked",false);//单独优惠支付积分类型
			$("#oppoint").val(""); //单独优惠支付积分值值
			$("input[name='onlypaydedu']").prop("checked",false);//单独优惠支付抵扣券类型值
			$("#opdedu").val(""); //单独优惠支付抵扣券值
			$("input[name='onlypaycoupon']").prop("checked",false);//单独优惠支付优惠券类型值
			$("#opcoupon").val(""); //单独优惠支付积教育分值
			
			$("input[name='mpayprice']").prop("checked",false);//组合货币支付类型值
			
			$("#muchsellerprice").val(""); //组合支付货币支付价格
			$("input[name='mpaypoint']").prop("checked",false);//组合支付积分值类型值
			$("#mppoint").val(""); //组合支付积分值值
			$("input[name='mpaydedu']").prop("checked",false);//组合支付抵扣券类型值
			$("#mpdedu").val(""); //组合支付抵扣券值
			$("input[name='mpaycoupon']").prop("checked",false);///组合支付优惠券类型值
			$("#mpcoupon").val(""); //组合支付积教育分值
		}
	} */
function deltTablElement(){
     var check = document.getElementsByName("specChecks");
     var ths=check.length;
     var numb=parseFloat($("#chooseSpecNum").html());
     for(var i=0;i<check.length;i++){
         if(check[i].checked){
              document.getElementById('tablespec').deleteRow(i);
              i--;
              numb--;
         }
     }
     $("#chooseSpecNum").text((numb));
     $("#specid").val((numb));
 } 
 //详情图片
 var imagesXiang;
 function toXiang(){
 	imagesXiang = Kit.dialog("详情图片","${BASE_PATH}/bus/goods/base/imageDetailIndex/${goods.LunBoNum}",{closable:true,size:"size-wide"}).open();
 }
var kindEditor;
kindEditor = KindEditor.create($("textarea[name='content']"), {
	width:'100%',
	height:'560px',
	resizeType :0,//2或1或0，2时可以拖动改变宽度和高度，1时只能改变高度，0时不能拖动。
	langType : 'zh_CN',
    allowUpload : true, 
    allowImageRemote: false,
    uploadJson : '${BASE_PATH}/bus/goods/base/uploadimg',
	items : [
		'preview','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
		'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
		'insertunorderedlist', '|', 'emoticons', 'image', 'link'], 
	afterCreate : function() {this.sync();}, 
    afterBlur:function() {this.sync();} 
 });
 
//点击事件取下级的值
$("#categoryonid").change(function(){
	categoryonid=$("#categoryonid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/bus/goods/base/categoryonid",
           data: {"categoryonid" : categoryonid},
           dataType: "json",
           traditional: true,
           success: function(data){
			$("#categorytwid").empty(); 
			$("#categorytwid").append("<option value=''>请选择二级分类</option>");
			console.log(categoryonid);
			console.log(categorytwid);
			for(var i=0; i<data.object.length;i++){
				$("#categorytwid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
				console.log(data.object[i].categoryId);
				}
           }
       });
    });
$("#categorytwid").change(function(){
	categorytwid=$("#categorytwid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/bus/goods/base/categorytwid",
           data: {"categorytwid" : categorytwid},
           dataType: "json",
           traditional: true,
           success: function(data){
          	   $("#categorythid").empty(); 
               $("#categorythid").append("<option value=''>请选择三级分类</option>");
               for(var i=0; i<data.object.length;i++){
              	 $("#categorythid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
$("#categorythid").change(function(){
	categorythid=$("#categorythid").val();
	
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/bus/goods/base/categorythid",
           data: {"categorythid" : categorythid},
           dataType: "json",
           traditional: true,
           success: function(data){
          	   $("#categoryfoid").empty(); 
               $("#categoryfoid").append("<option value=''>请选择四级分类</option>");
               for(var i=0; i<data.object.length;i++){
              	 $("#categoryfoid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
/* $("#categoryfoid").change(function(){
	categoryfoid=$("#categoryfoid").val();
    }); */
    
</script>

<form id="addForm" action="${BASE_PATH}/bus/goods/base/doEdit" method="post" autocomplete="off" class="form-horizontal" enctype="multipart/form-data" style="">
	
	<div class="form-group"  style="margin-left: 20px">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品基本信息</label>
	</div>
	<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品名称</label>
	    <div class="col-lg-9">
        	<input type="text" name="names" id="names" class="form-control" value="${goods.name}" required maxlength="40">
        	<input type="text" id="goodsid" name="goodsid" hidden="hidden" value="${goods.id }"/>
	    </div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品主图</label>
		<div class="col-sm-10">
			<input type="file" id="goodsthumb" name="goodsthumb" style="width:30%;" accept="image/jpg,image/png" title="添加商品Logo图" <c:if test="${goods.thumb!=null}">data-val="${goods.thumb}" </c:if>>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品轮播图</label>
		<div class="col-sm-10">
		 <input type='button' value='编辑轮播图' onclick="toUploadImages();" style="background-color: #428bca;width: 89.81px;height: 32px;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> 
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success"></span></div>
	</div>
	<c:if test="${userid==20 }">
		<div class="form-group">
		    <label class="col-lg-2 control-label">商品货号</label>
		    <div class="col-lg-9">
	        	<input type="text" id="goodsNum" name="goodsNum" class="form-control" value="${goods.goodsNum }">
		    </div>
		</div>
	</c:if>
	<%-- <div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品类目</label>
	    <div class="col-lg-9">
    		<select id="categoryonid" name="categoryonid" class="selectpicker"  data-width="24%" data-url="${BASE_PATH}/api/category" data-isfirst="true" data-val="${goods.categoryonid }" data-next="#categorytwid" data-key="id:name"></select>
			<select id="categorytwid" name="categorytwid" class="selectpicker" data-width="24%" data-url="${BASE_PATH}/api/categorys/{value}" data-val="${goods.categorytwid} " data-key="id:name"></select>			
	    </div>
	</div> --%>
	<!-- =========================================================商品分类======================================================== -->
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品类别</label>
	    <div class="col-sm-2">
        	<select name="categoryonid" id="categoryonid" class="form-control" required >
       			<option value="">一级分类</option>
       			<c:forEach items="${oneCategories}" var="category" varStatus="s">
					<option value="${category.categoryId}" <c:if test="${goods.categoryonid==category.categoryId}">selected</c:if> >${category.categoryName}</option>	
				</c:forEach>
        	</select>
	    </div>
	
	    <div class="col-sm-2">
        	<select name="categorytwid" id="categorytwid" class="form-control" required >
        		<option value="" 
        		<c:forEach items="${twoCategories}" var="category" varStatus="s">
					<option value="${category.categoryId}" <c:if test="${goods.categorytwid==category.categoryId}">selected</c:if> >${category.categoryName}</option>	
				</c:forEach>
				>二级分类</option>
        	</select>
	    </div>
	
	    <div class="col-sm-2">
		    <select name="categorythid" id="categorythid" class="form-control" required >
	        	<option value=""
        		<c:forEach items="${threeCategories}" var="category" varStatus="s">
					<option value="${category.categoryId}" <c:if test="${goods.categorythid==category.categoryId}">selected</c:if> >${category.categoryName}</option>	
				</c:forEach>
				>三级分类</option>
	        </select>
	    </div>
	
	    <div class="col-sm-2">
		    <select name="categoryfoid" id="categoryfoid" class="form-control" required >
	        	<option value=""
        		<c:forEach items="${fourCategories}" var="category" varStatus="s">
					<option value="${category.categoryId}" <c:if test="${goods.categoryfoid==category.categoryId}">selected</c:if> >${category.categoryName}</option>	
				</c:forEach>
				>四级分类</option>
	        </select>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>市场售价</label>
	    <div class="col-lg-3">
        	<input type="text" name="sellPrice" id="sellPrice" class="form-control" value="${goods.sellPrice}" onkeyup="(this.v3=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v3();" placeholder="请输入商品市场价" />
	    </div>
	</div>
		<!-- ================================================================================================================= -->
	<!-- 是否团购 -->
	<div class="form-group">
		<label class="col-lg-2 control-label">团购</label>
		<div class="col-lg-9 group">
			<label><input name="groupbuying" type="radio" value="1" <c:if test="${goods.groupbuying==1}">checked</c:if> />否   </label>
			<label><input name="groupbuying" type="radio" value="2" <c:if test="${goods.groupbuying==2}">checked</c:if> />是   </label>
			<div style="margin-right: 30px;" id="gbattr" >
				<label>团购价格<input type="text" name="gbprice" id="gbprice" value="${goods.gbprice}" size="10" placeholder="请输入数字" />元</label><br>
				<label>团购库存<input type="text" name="countnum" id="countnum" value="${goods.countnum}" size="10" placeholder="请输入库存数量" /></label><br>
				<label>团购人数<input type="text" id="gbperson" name="gbperson" value="${goods.gbperson}" size="10" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入数字"  />人</label><br>
				<div class="col-lg-9 gmethod">
					<label>团购方式</label>
					<input name="gbmethod" type="radio" value="1"<c:if test="${goods.gbmethod==1}">checked</c:if>/>普通
					<input name="gbmethod" type="radio" value="2"<c:if test="${goods.gbmethod==2}">checked</c:if>/>免单
					<div id="gbfpperson" >
						<div>免单人数<input type="text" name="gbfreeperson" id="gbfreeperson" value="${goods.gbfreeperson}" size="12" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入数字" />人</div><br>
						<div>付费人数<input type="text" name="gbpayperson" id="gbpayperson" value="${goods.gbpayperson}" size="12" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" placeholder="请输入数字" />人</div><br>		
  					</div>
  				</div><br>
				<div style=" float: left;">
					<label class="search-label"></label><input type="text" value="<fmt:formatDate value="${goods.gbbegintime}" type="date"/>" id="beginDate" autocomplete="off" name="gbbegintime" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" >
					<label class="search-label">至</label><input type="text" value="<fmt:formatDate value="${goods.gbbegintime}" type="date"/>" id="endDate" autocomplete="off" name="gbendtime" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" />
				</div>
			</div>
		</div>
	</div>
	<!-- 是否赠送优惠 -->
	<div class="form-group">
   	 <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>赠送优惠</label>
	    <div class="col-lg-9 zactivity" >
	        <label><input name="zsactivity" type="radio" value="1" <c:if test="${goods.zsactivity==1}">checked</c:if> />否   </label>
			<label><input name="zsactivity" type="radio" value="2" <c:if test="${goods.zsactivity==2}">checked</c:if> />是   </label>
			<div style="margin-right: 30px;" id="zsnumattr">
				<label><input name="zspoint" type="checkbox" value="1" <c:if test="${goods.zspointnum!=null&&goods.zspointnum!=0}">checked</c:if> /> 积分值 
					<input type="text" name="zspointnum" id="zspointnum" value="${goods.zspointnum}" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="zsdedu" type="checkbox" value="1"  <c:if test="${goods.zsdedunum!=null&&goods.zsdedunum!=0}">checked</c:if> /> 抵扣券
					<input type="text" name="zsdedunum" id="zsdedunum" value="${goods.zsdedunum}" size="12" placeholder="请输入数字" /></label><br>
				<label><input name="zscoupon" type="checkbox" value="1" <c:if test="${goods.zscouponnum!=null&&goods.zscouponnum!=0}">checked</c:if> /> 惠券
					<input type="text" name="zscouponnum" id="zscouponnum" value="${goods.zscouponnum}" size="12" placeholder="请输入数字" /></label>
			</div>
   		</div>
   	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>适用分公司</label>
	    <div class="col-lg-9">
    		<input type="button" value="增加分公司" onclick="addStore();" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> <span>已选分公司(<span id="chooseNum" >0</span>)</span>
    		<input type='button' value='删除分公司' id='deleteTablea' style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
    		<input type="text" id="storeid" name="storeid" hidden="hidden" value="1"/>
	    </div>
	</div>
	<div class="form-group">
	 <label class="col-lg-2 control-label"></label>
	     <div class="col-lg-9">
	     	<table id="tablea" style="width: 100%" border="1">
     			<tr>
     				<th  width="5%"  style="font-size: 14px;text-align: center;"><input type="checkbox"  name="checks" hidden="hidden"/>选择</th>
     				<th  width="15%" style="font-size: 14px;text-align: center;">分公司名称</th>
     				<th  width="20%" style="font-size: 14px;text-align: center;">分公司地址</th>
     				<th  width="10%" style="font-size: 14px;text-align: center;">分公司电话</th>
     			</tr>
	     	</table>
	    </div>
	</div>
	<hr style=" height:1px;border:none;border-top:1px solid black;" />
	<div class="form-group">
	 <label class="col-lg-2 control-label">原有分公司</label>
	     <div class="col-lg-9">
	     	<table id="tabled" style="width: 100%" border="1">
     			<tr>
     				<th  width="15%" style="font-size: 14px;text-align: center;">分公司名称</th>
     				<th  width="20%" style="font-size: 14px;text-align: center;">分公司地址</th>
     				<th  width="10%" style="font-size: 14px;text-align: center;">分公司电话</th>
     			</tr>
     			<c:if test="${fn:length(store) > 0}">
					<c:forEach var="ad" items="${store}" varStatus="s">
						<tr>
							 <td style="font-size: 14px;text-align: center;">${ad.title }</td>
							 <td style="font-size: 14px;text-align: center;">${ad.address}</td>
							 <td style="font-size: 14px;text-align: center;">${ad.tel}</td>
						<tr>
					</c:forEach>
				</c:if>
	     	</table>
	    </div>
	</div>

<div style="display:none;">
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品规格设置</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>规格名称</label>
	    <div class="col-lg-9">
        	<input type="text" name="specName" id="specName" class="form-control" placeholder="请输入商品规格名称"  maxlength="20"><span>此处文字不多于20字</span>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>规格商品数量</label>
	    <div class="col-lg-9">
        	<input type="text" name="specNum" id="specNum" class="form-control" placeholder="请输入商品规格数量" onkeyup="(this.v123=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v123();" maxlength="20" /><span>例：5包/提，请输入5</span>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>分公司价</label>
	    <div class="col-lg-9">
        	<input type="text" name="marketPrice" id="marketPrice" class="form-control" onkeyup="(this.v12=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v12();"placeholder="请输入分公司价格">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>库存数量</label>
	    <div class="col-lg-9">
        	<input type="text" id="stock" name="stock" class="form-control" onkeyup="(this.v4=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v4();" placeholder="请输入商品库存" />
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>支付方式</label>
	    <div class="col-lg-9" >
	        <label>货币支付
	        	<input type="text" name="sellerprice" id="sellerprice" size="12"  onkeyup="(this.v0=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v0();" placeholder="元"/>
	        </label><br>
	   </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">保存删除规格</label>
	    <div class="col-lg-9">
    		<input type="button" value="添加规格" onclick="addSpec();" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> <span>已加规格(<span id="chooseSpecNum" >${fn:length(goodSpec)}</span>)</span>
    		<input type='button' value='删除规格' id='delTablea'  onclick="deltTablElement();" style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
    		<input type="text" id="specid" name="specid" hidden="hidden" value="0"/>
	    </div>
   </div>
   <div class="form-group">
    	<label class="col-lg-2 control-label"></label>
	     <div class="col-lg-9">
	     	<table id="tablespec" style="width: 100%" border="1">
     			<tr>
     				<th style=" width:5%;font-size: 14px;text-align: center;"><input type="checkbox" name="specChecks" hidden="hidden"/>选择</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">规格名称</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">规格数量</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">门市价/元</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">库存数量</th>	
     				<th style=" width:15%;font-size: 14px;text-align: center;">货币</th>
     				<!-- <th style=" width:15%;font-size: 14px;text-align: center;">优惠类型</th>
     				<th style=" width:20%;font-size: 14px;text-align: center;">货币/优惠类型</th>  -->
     			</tr>
				<c:if test="${fn:length(goodSpecs) > 0}">
					<c:forEach var="adk" items="${goodSpecs}" varStatus="s">
						<tr>
							<td style="font-size: 14px;text-align: center;">
								<input type="checkbox" id="ids" checked="checked" name="specChecks" value="${adk.id}"/>
							</td>
							<td  style="font-size: 14px;text-align: center;">
								<input type="text" id="KspecName" hidden="hidden" name="KspecName"  value="${adk.specTitle}"/>
								${adk.specTitle }
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="KspecNum" hidden="hidden" name="KspecNum" value="${adk.specNum}"/>
								${adk.specNum }
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="KmarketPrice" hidden="hidden" name="KmarketPrice" value="${adk.marketPrice}"/>
								${adk.marketPrice }
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="Kstock" hidden="hidden" name="Kstock" value="${adk.stockNum}"/>
								${adk.stockNum }
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="Ksellerprice" hidden="hidden" name="Ksellerprice" value="${adk.sellerPrice}"/>
								${adk.sellerPrice }
							</td>
							<!-- 判断是否为单货币支付 -->
							
							<%-- <td style="font-size: 14px;text-align: center;">
							<input type="text" id="Kmultipay" hidden="hidden" name="Kmultipay" value="${adk.multipay}"/>
							<input type="text" id=Ksellerprice hidden="hidden" name="Ksellerprice" value="${adk.sellerPrice }"/>
								<c:if test="${adk.multipay != 1}">
									无
								</c:if>
								<c:if test="${adk.multipay == 1}" >
									${adk.sellerPrice }
								</c:if>
							</td> --%>
							<%-- <td style="font-size: 14px;text-align: center;">
								<input type="text" id="Koppoint" hidden="hidden" name="Koppoint" value="${adk.opPoint}"/>
								<input type="text" id="Kopdedu" hidden="hidden" name="Kopdedu" value="${adk.opDedu}"/>
								<input type="text" id="Kopcoupon" hidden="hidden" name="Kopcoupon" value="${adk.opCoupon}"/>
								<c:if test="${adk.multipay != 2}">
									无
								</c:if>
								<c:if test="${adk.multipay == 2 }" >
									<c:if test="${adk.opPoint != 0 }" >
										积分:${adk.opPoint}
									</c:if>
									<c:if test="${adk.opDedu != 0 }" >
										;折扣券:${adk.opDedu}
									</c:if>
									<c:if test="${adk.opCoupon != 0 }" >
										;优惠券:${adk.opCoupon}
									</c:if>
								</c:if>
							</td>
							<!-- 判断组合支付的值 -->
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="Kmuchsellerprice" hidden="hidden" name="Kmuchsellerprice" value="${adk.muchsellerPrice}"/>
								<input type="text" id="Kmppoint" hidden="hidden" name="Kmppoint" value="${adk.mpPoint}"/>
								<input type="text" id="Kmpdedu" hidden="hidden" name="Kmpdedu" value="${adk.mpDedu}"/>
								<input type="text" id="Kmpcoupon" hidden="hidden" name="Kmpcoupon" value="${adk.mpCoupon}"/>
								
								<c:if test="${adk.pmActivity != 3}">
									无
								</c:if>
								<c:if test="${adk.pmActivity == 3 }" >
									${adk.muchsellerPrice}/
									<c:if test="${adk.mpPoint != 0 }" >
										积分:${adk.mpPoint}
									</c:if>
									<c:if test="${adk.mpDedu != 0 }" >
										;折扣券:${adk.mpDedu}
									</c:if>
									<c:if test="${adk.mpCoupon != 0 }" >
										;优惠券:${adk.mpCoupon}
									</c:if>
								</c:if>
							</td> --%>
	     				</tr>
					</c:forEach>
				</c:if>
	     	</table>
	    </div>
	</div>
</div>
	<!-- ***************************************销售信息***************************************** -->
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">销售信息</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;" />
		<label class="col-sm-2 control-label">修改</label>
   <div class="form-group">
    	<label class="col-lg-2 control-label"></label>
	     <div class="col-lg-9">
	     	<table id="tablesale" style="width: 100%" border="1">
     			<tr>
     				<th style=" width:8%;font-size: 14px;text-align: center;"><input type="checkbox" name="saleChecks" hidden="hidden"/>启用</th>
     				<th style=" width:35%;font-size: 14px;text-align: center;">参数</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">价格</th>
     				<th style=" width:10%;font-size: 14px;text-align: center;">库存</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">内部码</th>	
     				<th style=" width:20%;font-size: 14px;text-align: center;">国际码</th>
     			</tr>
				<c:if test="${fn:length(goodsSales) > 0}">
					<c:forEach items="${goodsSales}" var="goodsSale" varStatus="s">
						<tr>
							<td style="font-size: 12px;text-align: center;">
								<input type="checkbox" id="saleIds" checked="checked" name="saleIds" value="${goodsSale.id}"/>
							</td>
							<td  style="font-size: 12px;text-align: center;">
								<input type="text" id="KpropvalnameArr" name="KpropvalnameArr"  hidden="hidden" value="${goodsSale.goodsSpec}"/>
								<!-- 隐藏域用于传值 -->
								<input type="text" id="Ktemplateid" name="Ktemplateid"  hidden="hidden" value="${goodsSale.templateid}"/>
								<input type="text" id="Ktitle" name="Ktitle"  hidden="hidden" value="${goodsSale.title}"/>
								${goodsSale.goodsSpec}
							</td>
							<td style="font-size: 12px;text-align: center;">
								<input type="text" id="KskuPrice" name="KskuPrice" value="${goodsSale.saleprice}"/>
							</td>
							<td style="font-size: 12px;text-align: center;">
								<input type="text" id="KskuStock" name="KskuStock" value="${goodsSale.salestock}"/>
							</td>
							<td style="font-size: 12px;text-align: center;">
								<input type="text" id="KskuCoding" name="KskuCoding" value="${goodsSale.coding}"/>
							</td>
							<td style="font-size: 12px;text-align: center;">
								<input type="text" id="KskuBarcode" name="KskuBarcode" value="${goodsSale.barcode}"/>
							</td>
							
	     				</tr>
					</c:forEach>
				</c:if>
	     	</table>
	    </div>
	</div>
<!-- 宝贝内容******************************************************************************** -->
	<div style="display:none;">
	
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品内容信息</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class=" col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>套餐内容 </label>
	    	<div class="col-lg-9">
	        	<input type="button" value="增加内容" id="addTable" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/>
	        	<input type='button' value='删除内容' id='deleteTable' style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
        	</div>
    </div>
    <div class="col-lg-9" style="margin-left: 136px">
       	<table id="tableb" style="width: 100%" border="1">
   			<tr>
   				<th  width="5%"  style="font-size: 14px;text-align: center;"><input type="checkbox"  name="check" hidden="hidden"/>选择</th>
   				<th  width="15%" style="font-size: 14px;text-align: center;">名称</th>
   				<th  width="15%" style="font-size: 14px;text-align: center;">数量</th>
   				<th  width="15%" style="font-size: 14px;text-align: center;">价值</th>
	     		<c:if test="${fn:length(goodItem) > 0}">
					<c:forEach var="ads" items="${goodItem}" varStatus="s">
						<tr>
						    <td style="font-size: 14px;text-align: center;"><input type="checkbox" checked="checked" name="check" value="${ads.id }"></td>
							 <td style="font-size: 14px;text-align: center;"><input type="text" name="name" value="${ads.itemname }" style="width:195px;height:30px;"/></td>
							 <td style="font-size: 14px;text-align: center;"><input type="text" name="number"  value="${ads.itemnum }" style="width:195px;height:30px;"/></td>
							 <td style="font-size: 14px;text-align: center;"><input type="text" name="price"value="${ads.itemmoney }" style="width:195px;height:30px;"/></td>
						</tr>
					</c:forEach>
				</c:if>
   			</tr>
     	</table>
    </div>
	<div class="form-group"  style="margin-top: 50px">
	  <label class="col-lg-2 control-label">添加可选服务:</label>
	    	
	       <div class="col-lg-9" style="margin-top: 20px" id="keke" >
	        <textarea rows="5" cols="80" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" name="kemark" id="" >${goods.kemark}</textarea>
	      </div>
    </div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>售卖时间:</label>
	    <div style="margin-left: 30px;">
	    	<label class="search-label"></label><input type="text" id="sBeginDate" autocomplete="off" name="sBeginDate" value="${goods.starttime}" class="width120 datetimepicker" data-format="yyyy-mm-dd"  required>
			至<input type="text" id="sEndDate" autocomplete="off" name="sEndDate" value="${goods.endtime}" class="width120 datetimepicker" data-format="yyyy-mm-dd"  required>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">兑换有效期</label>
	    <div class="col-lg-9 tuan">
	       	
	       <label><input name="goods" type="radio" value="1" <c:if test="${goods.goodtype ==1 }">checked</c:if>/>实物商品   （下单付款后，7个工作日到店兑换有效，如果过期未兑换，购买款项将自动返还给客户）</label>
	    	<label><input name="goods" type="radio" value="2" <c:if test="${goods.goodtype ==2 }">checked</c:if> />服务类商品 </label>
				<div style="margin-left: 30px;" id="tbts">
					<label><input name="times" type="radio" value="1" <c:if test="${goods.times ==1 }">checked</c:if>/>兑换有效期与售卖时间相同</label><br>
					<label><input name="times" type="radio" value="2" <c:if test="${goods.times ==2 }">checked</c:if>/>兑换有效期与售卖时间不同</label> 
						<div style=" float: right;" id="tbtd">
					        <label class="search-label"></label><input type="text" id="beginDate" autocomplete="off" value="${goods.tuanStarttime }" name="beginDate" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" >
							<label class="search-label">至</label><input type="text" id="endDate" autocomplete="off" value="${goods.tuanEndtime }" name="endDate" class="form-control search-input width120 datetimepicker" data-format="yyyy-mm-dd" />
		   				</div>
		   			
	   			</div>
	   		
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">可用时间</label>
	    <div class="col-lg-9 kysj" >
		  <label><input name="keyong" type="radio" value="1" <c:if test="${goods.timetype ==1 }">checked</c:if>/>不限时间 </label><br>
		  <label><input name="keyong" type="radio" value="2" <c:if test="${goods.timetype ==2 }">checked</c:if>/>部分时间可用  </label> 
	  		<div style="float: right;" id="bufen">
				  <select id="starttime"  name="starttime"><option value="1" <c:if test="${goods.busetime==1 }">selected</c:if>>周一</option><option value="2" <c:if test="${goods.busetime==2 }">selected</c:if>>周二</option><option value="3" <c:if test="${goods.busetime==3 }">selected</c:if>>周三</option><option value="4" <c:if test="${goods.busetime==4 }">selected</c:if>>周四</option><option value="5" <c:if test="${goods.busetime==5 }">selected</c:if>>周五</option><option value="6" <c:if test="${goods.busetime==6 }">selected</c:if>>周六</option><option value="7" <c:if test="${goods.busetime==7 }">selected</c:if>>周日</option></select>
				    至 <select id="endtime"  name="endtime"><option value="1" <c:if test="${goods.eusertime==1 }">selected</c:if>>周一</option><option value="2" <c:if test="${goods.eusertime==2 }">selected</c:if>>周二</option><option value="3" <c:if test="${goods.eusertime==3 }">selected</c:if>>周三</option><option value="4" <c:if test="${goods.eusertime==4 }">selected</c:if>>周四</option><option value="5" <c:if test="${goods.eusertime==5 }">selected</c:if>>周五</option><option value="6" <c:if test="${goods.eusertime==6 }">selected</c:if>>周六</option><option value="7" <c:if test="${goods.eusertime==7 }">selected</c:if>>周日</option></select>
			</div>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">单人购买上限</label>
	    <div class="col-lg-9 gmsx">
	       
	            <label><input name="goumai" type="radio" value="1" <c:if test="${goods.buytype==1 }">checked</c:if>/>无上限</label><br>
	            <label><input name="goumai" type="radio" value="2" <c:if test="${goods.buytype==2 }">checked</c:if>/>指定上限<span id="zdsx"><input type="text" id="zdsx" value="${goods.buycount }" name="zdsx" required size="10" placeholder="" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" />次</span></label>
	    </div>
	</div>
	<div class="form-group">
	  <label class="col-lg-2 control-label">是否需要预约</label>
	       <div class="col-lg-9 xyyy">
	         <label><input name="yuyue" type="radio" value="1" <c:if test="${goods.yutype==1 }">checked</c:if>/>否</label><br>
	         <label><input name="yuyue" type="radio" value="2" <c:if test="${goods.yutype==2 }">checked</c:if>/>是  <span id="yyts">请您提前<input type="text" id="yyts" name="yyts" value="${goods.yuday }" required size="10" placeholder="" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" /> 天预约</span></label>
		   </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">适用人数</label>
	     <div class="col-lg-9 syrs">
	    	  <label><input name="shiyongrenshu" type="radio" value="0" <c:if test="${goods.couper==0 }">checked</c:if>/>不显示</label><br>
		    <label><input name="shiyongrenshu" type="radio" value="1" <c:if test="${goods.couper==1 }">checked</c:if>/>不限人数</label><br>
			<label><input name="shiyongrenshu" type="radio" value="2" <c:if test="${goods.couper==2 }">checked</c:if>/>建议人数<span id="jyrs"><input type="text" id="jyrss" required name="jyrs" size="10" value="${goods.jyrs }" placeholder="" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" /> 人</span></label><br>
			<label><input name="shiyongrenshu" type="radio" value="3" <c:if test="${goods.couper==3 }">checked</c:if>/>限制人数 <span id="xzrs">每张券最多<input type="text" id="xzrss" name="zdrs" size="10" value="${goods.zdrs }" placeholder="" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" /> 人使用</span></label>
		    
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">性别限定</label>
	     <div class="col-lg-9">
	       <label><input name="xingbiexianding" type="radio" value="0" <c:if test="${goods.shiyongren==0 }">checked</c:if>/>不显示</label><br>
		    <label><input name="xingbiexianding" type="radio" value="1" <c:if test="${goods.shiyongren==1 }">checked</c:if>/>男女通用</label><br>
			<label><input name="xingbiexianding" type="radio" value="2" <c:if test="${goods.shiyongren==2 }">checked</c:if>/>仅限女宾</label><br>
			<label><input name="xingbiexianding" type="radio" value="3" <c:if test="${goods.shiyongren==3 }">checked</c:if>/>仅限男宾</label>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">适用规则</label>
	    <div class="col-lg-9">
		     <label><input name="shiyongguize" type="radio" value="1" <c:if test="${goods.regul==1 }">checked</c:if>/>不再与其他优惠同享</label><br>
			 <label><input name="shiyongguize" type="radio" value="2" <c:if test="${goods.regul==2 }">checked</c:if>/>可与其他优惠同享</label>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">补充内容</label>
	    <div class="col-lg-9">
	        <textarea rows="5" cols="80" name="bucong" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" id="bucong">${goods.content }</textarea>
	    </div>
	</div>
	
	</div> 
	<!-- ***********宝贝内容******************end*********************************** -->
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品详情</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;"/>
	

	<div class="form-group">
	    <label class="col-lg-2 control-label">商品简介</label>
	    <div class="col-lg-9">
	        <textarea rows="5" cols="80" name="shortinfo" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" id="shortinfo">${goods.shortInfo }</textarea>
	    </div>
	</div>
	<!-- <div class="form-group">
			<label class="col-lg-2 control-label"><span class="must-fill">*</span>商品内容：</label>
			<div class="col-lg-8">
				 <textarea name="content" class="form-control" rows="60" placeholder="" required></textarea>
			</div>
	</div> -->

	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>详情图片</label>
		<div class="col-sm-10">
		 <input type='button' value='添加详情图片' onclick="toXiang();" style="background-color: #337ab7;width: 100px;height: 32px;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> 
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success"></span></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">备注</label>
		<div class="col-sm-10">
	        <textarea rows="5" cols="80" name="beizhu" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" >${goods.beizhu}</textarea>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>客服二维码</label>
		<div class="col-sm-10">
			<input type="file" id="Qrthumb" name="Qrthumb"  style="width:30%;" accept="image/jpg,image/png" title="添加客服二维码" <c:if test="${goods.Qrthumb!=null}">data-val="${goods.Qrthumb}" </c:if> >
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" >提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left"  type="button" onclick="javascript:editDialog.close();" >取消</button></div>
	</div>
	<input type="hidden" name="thumbOld" value="${goods.thumb}"/>
	<input type="hidden" name="QrthumbOld" value="${goods.Qrthumb}"/>
	<input type="hidden" name="id" value="${goods.id}"/>
	<input type="hidden" name="LunBoNum" value="${goods.LunBoNum}"/>
</form>
</body>
</html>